//
//  UIViewController+WXSMessage.m
//  SleepBooks
//
//  Created by rimi on 16/9/29.
//  Copyright © 2016年 rimi. All rights reserved.
//

#import "UIViewController+WXSMessage.h"

@implementation UIViewController (WXSMessage)
- (void)showPromptWithMessage:(NSString *)message{
    UILabel *prompt = [[UILabel alloc]init];
    prompt.backgroundColor = [UIColor whiteColor];
    prompt.textAlignment = NSTextAlignmentCenter;
    prompt.textColor = [UIColor colorWithRed:89/255.0 green:202/255.0 blue:195/255.0 alpha:1];
    
    prompt.font = [UIFont systemFontOfSize:20];
    prompt.text = message;
    CGRect rect = [message boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, 60) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20]} context:nil];
    rect.size.width += 20;
    rect.size.height = 50;
    prompt.bounds = rect;
    CGPoint center = self.view.center;
    center.y *= 1.5;
    prompt.center = center;
    prompt.tag = 1000;
    [self.view addSubview:prompt];
    
    
    [self performSelector:@selector(removePrompt) withObject:nil afterDelay:2.0];
}
@end
